<!DOCTYPE html>
<html>
	<head>
		<title>修改密码</title>
		<meta charset="utf-8">
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!-- 所有的 css & js 资源 -->
		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
		<link rel="stylesheet" href="../../static/sa.css">
		
		<script src="../../static/kj/vue.min.js"></script>
		<script src="../../static/kj/axios.min.js"></script>
		<script src="../../static/kj/element-ui/index.js"></script>
		<script src="../../static/kj/jquery.min.js"></script>
		<script src="../../static/kj/layer/layer.js"></script>

		<script src="../../static/sa.js"></script>
		<script src="../../sa-resources/config.js"></script>

		<style type="text/css">

		</style>
	</head>
	<body>
		<div class="vue-box" style="display: none;" :style="'display: block;'">
			<el-form ref="form" :model="data" label-width="80px">
				<el-form-item label="旧的密码">
					<el-input v-model="data.old" type="password"></el-input>
				</el-form-item>

				<el-form-item label="新的密码">
					<el-input v-model="data.pwd" type="password"></el-input>
				</el-form-item>

				<el-form-item label="确认密码">
					<el-input v-model="data.cpwd" type="password"></el-input>
				</el-form-item>

				<el-form-item>
					<el-button type="primary" @click="submit">保存</el-button>
					<el-button>取消</el-button>
				</el-form-item>
			</el-form>
		</div>

		<script src="../../sa-resources/api.js"></script>
		<script src="../../sa-resources/wuyan.js"></script>
		<script src="../../sa-resources/element-ui-helper.js"></script>

		<script>
			var app = new Vue({
				el: '.vue-box',
				data: {
					data: {
						old: '',
						pwd: '',
						cpwd: '',
					},
				},
				created: function() {
					axiosConfig(axios)
				},
				mounted() {},
				methods: {
					// 修改
					submit() {
						let loading = elLoadding({
							that: this
						})

						let url = getUrl('auth', 'change-pwd', {
							old: this.data.old,
							pwd: this.data.pwd
						})
						let http = getHttp(axios, 'auth', 'change-pwd')
						http(url, {})
							.then(res => {
								parent.location.href = "../../login.html"
								loading.close()
							})
							.catch((err) => { // 请求失败处理
								sa.error(err.msg);
								loading.close()
							});
					},
				}
			})
		</script>
	</body>
</html>
